package lagou.homework.lagouhomework.Unit4.code.q1;


import java.util.List;

public class AddStu {
    public static void addStu(int id, String name, int age, List<Student> listStu){
        Student stu = new Student(id,name,age);
        boolean b1 = listStu.contains(stu);
        if(b1){
            System.out.println("该学生已存在.");
        }else{
            listStu.add(stu);
            System.out.println("添加成功！");
        }

    }

}
